<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/detail.css">
    <link rel="shortcut icon" href="./imgs/favicon.png" type="image/x-icon">
    <script async="async" src="https://www.google.com/adsense/search/ads.js"></script>
    <title>Funny Money</title>
    <!-- other head elements from your page -->
    <script type="text/javascript" charset="utf-8">
        (function (g, o) {
            g[o] = g[o] || function () {
                (g[o]['q'] = g[o]['q'] || []).push(
                    arguments)
            }, g[o]['t'] = 1 * new Date
        })(window, '_googCsa');
    </script>
</head>

<body>
    <div id="app" v-cloak>

        <share :title="detail.title" :is-detail="true" :id="id"></share>

        <popup v-model="showSide">
            <side-nav></side-nav>
        </popup>

        <div class="load" v-if="loading">
            <img src="./imgs/loading.svg" alt="load">
        </div>

        <div class="container" v-else>

            <side-header @menu-click="handleOpenSideBar">
                <side-nav></side-nav>
            </side-header>

            <div class="container-main">
                <div class="main">
                    <div class="article">
                        <h1 class="article-title">{{detail.title}}</h1>
                        <span class="article-sub">{{detail.information}}</span>
                        <div id="relatedsearches1" style="margin: 5px 0;"></div>
                        <p class="article-content" v-html="detail.blogContent"></p>
                    </div>

                    <comment :id="id" :site="siteId"></comment>

                    <div class="recommend">
                        <ul class="recommend-list">
                            <li class="recommend-list-item" v-for="item in recommend">
                                <news-box :options="item" :key="item.id"></news-box>
                            </li>
                        </ul>
                    </div>
                </div>

                <!-- <aside class="aside"></aside> -->
            </div>

        </div>

        <side-footer v-if="!loading"></side-footer>

        <cookies></cookies>

    </div>
</body>
<script src="./main.js"></script>
<script src="./mixins/index.js"></script>
<script src="./components/header.js"></script>
<script src="./components/footer.js"></script>
<script src="./components/popup.js"></script>
<script src="./components/nav.js"></script>
<script src="./components/share.js"></script>

<script src="./components/newsBox.js"></script>
<script src="./components/cookies.js"></script>
<script src="./components/comment.js"></script>
<script src="./js/vue.js"></script>
<script>
    var vm = new Vue({
        el: '#app',
        mixins: [mixin],
        components: {
            SideHeader: header,
            SideFooter: footer,
            SideNav: nav,
            Popup: popup,
            newsBox: news,
            cookies: cookies,
            share: share,
            comment: comment
        },
        data() {
            return {
                detail: {},
                list: [],
                id: 0,
                type: 0,
                siteId
            }
        },
        computed: {
            recommend() {
                return this.list.filter(item => item.id != this.id)
            }
        },
        created() {
            this.id = getQueryVariable('id') ? getQueryVariable('id') : 920
            
            const typeName = getQueryVariable('typeName') ? decodeURIComponent(getQueryVariable('typeName')) : 'Finance'

            this.type = nav.data().categories.find(item => item.name == typeName)

            this.handleFetchArticleDetail()
            this.handleFetchArticle()

            // if (getQueryVariable('referrerAdCreative')) {
            //     gtag('event', 'referrerAdCreative', {
            //         'referrerAdCreativeText': 'desc: ' + this.getQueryVariable('referrerAdCreative')
            //     })
            // }
        },
        methods: {
            loadAfs() {
                const terms = 'Online Bank Account Opening,Bank Account Opening,Bank Account Opening Customer Journey,Digital Account Opening Solutions'
                var pageOptions = {
                    "pubId": "partner-pub-8180331903483073", // 确保这是正确的客户 ID！
                    "styleId": "5656699401",
                    "terms": this.detail.keyword ? this.detail.keyword : terms,
                    "channel": "3977029528",
                    "relatedSearchTargeting": "content",
                    "resultsPageBaseUrl": "https://www.thefunnymoney.com/search.html?", // 输入您的结果页的基准网址
                    "resultsPageQueryParam": "keywords", // （默认设为“q”）匹配搜索页上表示查询的参数
                    // "query": this.fetch ? this.detail.title : this.detail.keywords,
                    "referrerAdCreative": getQueryVariable('referrerAdCreative') ? getQueryVariable('referrerAdCreative') : this.detail.title
                };

                var rsblock1 = {
                    "container": "relatedsearches1",
                    "relatedSearches": 4
                };

                _googCsa('relatedsearch', pageOptions, rsblock1);
            },
            handleFetchArticleDetail() {
                fetch('https://migame.vip/gamefront/blog/findBlogApiOne', {
                    headers: {
                        'Content-Type': 'application/json; charset=utf-8'
                    },
                    method: 'post',
                    body: JSON.stringify({
                        id: this.id
                    })
                })
                    .then(res => res.json())
                    .then(res => {
                        if (res.code == 0) {
                            this.detail = res.data
                            document.title = res.data.title
                        }
                        this.handleLoadingEnd()
                        this.$nextTick(this.loadAfs)
                    })
                    .catch(err => {
                        throw new Error(err)
                    })
            },
            handleFetchArticle() {
                fetch('https://migame.vip/gamefront/blog/blogApiList', {
                    headers: {
                        'Content-Type': 'application/json; charset=utf-8'
                    },
                    method: 'post',
                    body: JSON.stringify({
                        pageNum: 1,
                        pageSize: 6,
                        blogTypeId: this.type ? this.type.id : 1,
                        siteId,
                    })
                })
                    .then(res => res.json())
                    .then(res => {
                        if (res.code == 0) {
                            this.list = res.data
                        }
                    })
                    .catch(err => {
                        throw new Error(err)
                    })
            },
        }
    })
</script>
<script>
    var pattern = /^master/;
    window.addEventListener('blur', function () {
        if (pattern.test(document.activeElement.id)) {
            gtag('event', 'content_click', {
                'event_name': 'content_click'
            })
            // obApi('track', 'Download');
            fbq('track', 'AddToCart')
        }
    })
</script>
</html>